/*
 * @Description: minxi 监听浏览器宽度变化
 * @Version: 2.0
 * @Autor: Seven
 * @Date: 2020-12-17 11:22:32
 * @LastEditors: Seven
 * @LastEditTime: 2020-12-17 11:56:00
 */
export default {
    data(){
        return {
            clientWidth:767
        }
    },
    mounted() {
        // 进入页面时监听游览器宽度的变化
        this.getWidth();
	    window.addEventListener('resize', this.getWidth)
    },
    computed:{
        // 栅格的间距
        gutter() {
            return this.clientWidth > 768 ? 20 : 10;
        },
        // 移动端分页显示小型
        isSmall() {
            return this.clientWidth > 768 ? false : true;
        },
    },
    methods: {
        getWidth(){
           this.clientWidth = document.body.clientWidth
        }
    },
    beforeDestroy(){
        // 离开页面时取消监听
	    window.removeEventListener('resize', this.getHeight)
    }
}